class Solution(object):
    def generate(self, numRows):
        """
        :type numRows: int
        :rtype: List[List[int]]
        """
        if numRows == 0:
            return []
        if numRows == 1:
            return [[1]]
        if numRows == 2:
            return [[1], [1, 1]]
        numRows -= 2
        rList = [[1], [1, 1]]
        while numRows > 0:
            newList = [1]
            for i in range(len(rList[-1]) - 1):
                newList.append(rList[-1][i] + rList[-1][i + 1])
            newList.append(1)
            rList.append(newList)
            numRows -= 1
        return rList


if __name__ == '__main__':
    s = Solution()
    print(s.generate(10))
"""
0    [[1], 
1    [1, 1], 
2    [1, 2, 1], 
3    [1, 3, 3, 1], 
     [1, 4, 6, 4, 1], 
     [1, 5, 10, 10, 5, 1], 
     [1, 6, 15, 20, 15, 6, 1],
     [1, 7, 21, 35, 35, 21, 7, 1], 
     [1, 8, 28, 56, 70, 56, 28, 8, 1], 
     [1, 9, 36, 84, 126, 126, 84, 36, 9, 1]]
"""
